using System;
using System.Runtime.Serialization;

using Pegasus.Diagnostics;

namespace Pegasus
{
	/// <summary>
	/// Generic Pegasus Exceptions
	/// </summary>
	[Serializable]
	public class PegasusException : Exception
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:WorkflowNotFoundException"/> class.
		/// </summary>
		public PegasusException()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="T:WorkflowNotFoundException"/> class.
		/// </summary>
		/// <param name="message">The message.</param>
		/// <param name="args">The args.</param>
		public PegasusException( string message, params object[] args ) :
			base( string.Format( message, args ) )
		{
			// Check Parameters
			ParamCode.AssertNotEmpty( message, "message" );
			ParamCode.AssertNotNull( args, "args" );
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="T:WorkflowNotFoundException"/> class.
		/// </summary>
		/// <param name="info">The info.</param>
		/// <param name="context">The context.</param>
		protected PegasusException( SerializationInfo info, StreamingContext context ) :
			base( info, context )
		{
			// Check Parameters
			ParamCode.AssertNotNull( info, "info" );
			ParamCode.AssertNotNull( context, "context" );
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="T:WorkflowNotFoundException"/> class.
		/// </summary>
		/// <param name="innerException">The inner exception.</param>
		/// <param name="message">The message.</param>
		/// <param name="args">The args.</param>
		public PegasusException( Exception innerException, string message, params object[] args ) :
			base( string.Format( message, args ), innerException )
		{
			// Check Parameters
			ParamCode.AssertNotNull( innerException, "innerException" );
			ParamCode.AssertNotEmpty( message, "message" );
			ParamCode.AssertNotNull( args, "args" );
		}
	}
}
